gtkstylecontext: Add an optional warning when misusing GtkStyleContext
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 25 Nov 2014 19:07:31 +0000 (11:07 -0800)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 25 Nov 2014 19:07:31 +0000 (11:07 -0800)
This allows someone to quickly debug more performance issues with
G_DEBUG=fatal-warnings.

gtk/gtkstylecontext.c

index 37f330d2f0ba9e1f11345aee0aabe6a9da9319ed..3745804f0d832424d4f1bc0a7f1443ee28fd652b 100644 (file)
@@ -745,6 +745,9 @@ style_values_lookup_for_state (GtkStyleContext *context,
   if (gtk_css_node_declaration_get_state (context->priv->info->decl) == state)
     return g_object_ref (style_values_lookup (context));
 
+  if (g_getenv ("GTK_STYLE_CONTEXT_WARNING"))
+    g_warning ("State does not match current state");
+
   decl = gtk_css_node_declaration_ref (context->priv->info->decl);
   gtk_css_node_declaration_set_state (&decl, state);
   values = _gtk_css_computed_values_new ();